﻿using System;
using System.Threading.Tasks;
using Kele.Activity.Core;
using Kele.Core.Extensions;
using Microsoft.AspNetCore.Mvc;
using Kele.Core.Http;

namespace Kele.Activity.Web.Controllers.V1
{
    public class OrderController:SiteApiController
    {
        [HttpGet]
        [Route("record/detail")]
        public async Task<IActionResult> GetOrderList(int activity_id, string order_id)
        {
            var ret = await AppService.Record.GetRecordDetailAsync(activity_id, order_id);
            return OkResult(ret);
        }

        [HttpGet]
        [Route("record/list")]
        public async Task<IActionResult> GetRecordList(int activity_id, int take = 10, int skip = 0, string mobile = "")
        {
            var ret = await AppService.Record.GetRecordListAsync(activity_id, take, skip, mobile);
            return OkResult(ret);
        }

        [HttpPost]
        [Route("h5/record/create")]
        public async Task<IActionResult> H5_CreateRecordRegister(int activity_id)
        {
            var json = await Request.GetRawBodyStringAsync();
            //var ip = HttpContext.Connection.RemoteIpAddress.ToString();
            var result = await AppService.Record.H5_CreateRecordAsync(activity_id, UserId, json);
            return OkResult(result);
        }
    }
}